/**
 * Class matrix
 * 
 * @author Hussein Patwa
 * @date 10 March 2008 - Rev 07 May 2008
 * @version 2.0 Storage mechanism for the data contained within
 *          abdnmat.csv
 */
package trend;

import java.util.*;

@SuppressWarnings("all")
public class Matrix {
  /**
   * Constructor for matrix
   * 
   * @param data Data to be stored
   * @param rowNo Row number
   * @param colNo Column number
   */
  Vector data;
  int rowNo;
  int colNo;

  /** Creates a new instance of Matrix */
  public Matrix() {
  }

  public Matrix(Vector dat) {
    data = dat;
    Vector rowV = (Vector) data.get(0);
    rowNo = data.size();
    colNo = rowV.size();
  }

  /**
   * Get the position in the matrix
   * 
   * @param row Row number within the matrix
   * @param col Colum number within the matrix
   * @return double
   */
  public double get(int row, int col) {
    Vector rowV = (Vector) data.get(row);
    Double rtn = (Double) rowV.get(col);
    return rtn.doubleValue();
  }

  /**
   * Get row number from the matrix
   * 
   * @return int
   */
  public int getRowNo() {
    return rowNo;
  }

  /**
   * Get the colum number from the matrix
   * 
   * @return int
   */
  public int getColNo() {
    return colNo;
  }

  /**
   * Print the contents of the matrix
   * 
   * @return null
   */
  public void print() {
    for (int i = 0; i < rowNo; i++) {
      for (int j = 0; j < colNo; j++) {
        System.out.print(get(i, j) + " ");
      }
      System.out.println();
    }
  }

}
